package com.opdar.athena.singletask.base;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Created by shiju on 2017/8/16.
 */
public class SingleTaskContextListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        Object context = sce.getServletContext().getAttribute("applicationContext");
        AthenaServer server = new AthenaServer((ClassPathXmlApplicationContext) context);
        server.start();
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
